package interfaces.clients.dispatcher.replies;

import java.io.IOException;
import java.io.ObjectOutputStream;

/**
 * @author Mihail A. Muhin
 */
public class BaseReply {
	public void write(ObjectOutputStream oos) throws WriteCorrectableException {
		writeClassName(oos);
	}

	public void writeClassName(ObjectOutputStream oos) throws WriteCorrectableException {
		String full_name = this.getClass().getName();
		String name = full_name.substring(full_name.lastIndexOf(".") + 1, full_name.length());
		try {
			oos.writeObject(name);
		} catch (IOException e) {
			throw new WriteCorrectableException("Couldn't write reply to a user stream");
		}
	}
}
